package com.ostrich.demonavigation.fragment

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.core.os.bundleOf
import androidx.navigation.fragment.findNavController
import com.ostrich.demonavigation.R

class OneFragment : Fragment() {

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?,
    ): View? {
        val view = inflater.inflate(R.layout.fragment_one, container, false)
        view.findViewById<Button>(R.id.bt_fragment).setOnClickListener{



            findNavController().navigate(R.id.action_oneFragment_to_twoFragment)
        }
        view.findViewById<Button>(R.id.bt_activity).setOnClickListener{

            val bundle = bundleOf("username" to "yaotianxue")
            findNavController().navigate(R.id.action_oneFragment_to_mainActivity2,bundle)
        }
//        view.findViewById<Button>(R.id.bt_fragment).setOnClickListener{
//            findNavController().navigate(R.id.action_oneFragment_to_mainActivity3)
//        }
        return view
    }

}